package com.yitao.client.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @Date: 2020/1/4 16:19
 * @Author: Kien
 */
public class ShopUserGradeWealEnums {

    public enum DERATE_REQUIRE{
        NO_REQUIREMENT(0, "无要求"),
        CONDITIONAL(1, "满金额"),
        ;

        private Integer code;
        private String msg;
        private static Map<Integer, String> map = new HashMap<>();

        static {
            for(DERATE_REQUIRE derate_require: ShopUserGradeWealEnums.DERATE_REQUIRE.values()){
                map.put(derate_require.getCode(), derate_require.getMsg());
            }
        }

        DERATE_REQUIRE(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static String getMsgByCode(Integer code){
            return map.get(code);
        }
    }


    public enum DERATE_TYPE{
        PRODUCT_FULL_REDUCTION(1, "每件商品减"), //每件商品减金额
        PRODUCT_DISCOUNT(2, "每件商品"), // 每件商品折扣
        ORDER_REDUCTION(3, "订单满¥"), // 订单减免金额
        ;

        private Integer code;
        private String msg;
        private static Map<Integer, String> map = new HashMap<>();

        static {
            for(DERATE_TYPE derate_type: DERATE_TYPE.values()){
                map.put(derate_type.getCode(), derate_type.getMsg());
            }
        }

        DERATE_TYPE(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public static String findMsgByCode(Integer code){
            return map.get(code);
        }

    }
}
